package com.jt.provider.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RefreshScope  //外界感知这个值的变化
@RestController
public class ProviderCacheController {
    /***
     * 从配置文件或者配置中心中读取
     * 并将这个值赋值给useLocalCache
     */
    @Value("${useLocalCache:false}")
    private boolean useLocalCache;

    @RequestMapping("/provider/cache01")
    public String doUseLocalCache01(){
        return "useLocalCache' value is   "+useLocalCache;
    }

}
